package transporte.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import transporte.server.entity.TestEntity;
import transporte.server.seguridad.RequirePrivs;
import transporte.server.service.TransporteService;
import transporte.util.PrivConstant;

/**
 * Simple index page controller serving hello.jsp file 
 */
@Controller
@RequestMapping("/*")
public class HelloWorldController {

	@Autowired
	TransporteService transporteService;
	
    /**
     * Simply serves hello.jsp
     * @return view with name 'hello'
     */
    @RequestMapping
	@RequirePrivs(privs={PrivConstant.ADMINISTRAR})
    public void hello(ModelMap model) {
    	
    	TestEntity testEntity = transporteService.createTestEntity("bla bla bla");
    	
    	model.put("testEntity", testEntity);
    	
    }

}
